package xmla
import(
	"bytes"
	"strings"
)
type XMLADiscoverRestrictions struct{
	Catalog string
    CubeName string
    DimensionUniqueName string
    HierarchyUniqueName string
    LevelUniqueName string
    MemberUniqueName string
    TreeOp string
}
func (r *XMLADiscoverRestrictions) getPropertyListXML(indent string)(string){
	var buffer bytes.Buffer
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("<Restrictions>")
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("<RestrictionList>")
	cat_trim:=strings.TrimSpace(r.Catalog)
	if len(cat_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<CATALOG_NAME>")
		buffer.WriteString(cat_trim)
		buffer.WriteString("</CATALOG_NAME>")
	}
	cub_trim:=strings.TrimSpace(r.CubeName)
	if len(cub_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<CUBE_NAME>")
		buffer.WriteString(cub_trim)
		buffer.WriteString("</CUBE_NAME>")
	}
	dim_trim:=strings.TrimSpace(r.DimensionUniqueName)
	if len(dim_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<DIMENSION_UNIQUE_NAME>")
		buffer.WriteString(dim_trim)
		buffer.WriteString("</DIMENSION_UNIQUE_NAME>")
	}
	hie_trim:=strings.TrimSpace(r.HierarchyUniqueName)
	if len(hie_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<HIERARCHY_UNIQUE_NAME>")
		buffer.WriteString(hie_trim)
		buffer.WriteString("</HIERARCHY_UNIQUE_NAME>")
	}
	lev_trim:=strings.TrimSpace(r.LevelUniqueName)
	if len(lev_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<LEVEL_UNIQUE_NAME>")
		buffer.WriteString(lev_trim)
		buffer.WriteString("</LEVEL_UNIQUE_NAME>")
	}
	mem_trim:=strings.TrimSpace(r.MemberUniqueName)
	if len(mem_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<MEMBER_UNIQUE_NAME>")
		buffer.WriteString(mem_trim)
		buffer.WriteString("</MEMBER_UNIQUE_NAME>")
	}
	tre_trim:=strings.TrimSpace(r.TreeOp)
	if len(tre_trim)>0{
		buffer.WriteString("\n")
		buffer.WriteString(indent)
		buffer.WriteString(elementIndent)
		buffer.WriteString("<TREE_OP>")
		buffer.WriteString(tre_trim)
		buffer.WriteString("</TREE_OP>")
	}
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("</RestrictionList>")
	buffer.WriteString("\n")
	buffer.WriteString(indent)
	buffer.WriteString("</Restrictions>")
	return buffer.String()
}


